\subsection{Network}
\label{prestudy:identifyproblemandscenario:network}
%Hvorfor / hvornår er broadcast favorabelt i forhold til unicast. Herunder mindre undersøgelser af de trade-offs man måske skal beslutte sig for ved brug af broadcast (ex. øget pakketab til fordel for mange modtagere), samt de performance gains der kan hentes ved brug af broadcast.
In this section all the addressing methods in networking, relevant to the project will be discussed. When distributing video over \ac{WLAN}, there are several ways to address one or more receivers, such as unicast and broadcast.

\subsubsection{Unicast}
\label{prestudy:identifyproblemandscenario:network:unicast}
With unicast the packet are sent to only one sink at a time. Unicast enables handshake functionality, which ensures that the packets are only sent when both source and sink are ready. Furthermore unicast allows acknowledgement packets that ensures that they are retransmitted if necessary. These stability enhancements makes unicast considered reliable but they also require some additional transmission overhead which reduces the bandwidth.

\subsubsection{Broadcast}
\label{prestudy:identifyproblemandscenario:network:broadcast}
In a broadcast setting a packet is transmitted to all nodes on the network simultaneously. It is then up to each node to decide whether or not it wants the data. 
Broadcasting improves bandwidth of a network where one or more nodes requests the same data.
Broadcast is connectionless, which means that the overhead is smaller compared to unicast using a connection oriented protocol, e.g. the overhead of a UDP packet is 8 bytes \cite{ISIUDP} and the minimum overhead of TCP packet is 20 bytes \cite{IEEETCP}. Using UDP over unicast removes both the stability of unicast and the parallellity of broadcast, thus making it inappropriate for multi sink simultaneously video streams.
Unlike unicast, broadcast offers no native error control with the standardized connectionless protocols described in the OSI-model \fixme{Jo: Cite}, which is why it is considered unreliable. 

\subsubsection{Comparison of unicast and broadcast}
\label{prestudy:identifyproblemandscenario:network:comparisonofunicastandbroadcast}
When considering a scenario where packet loss will happen the reliable connection of unicast will have a lower loss rate than the unreliable broadcast.
Unicast will automatically correct transmission errors using the flow and error control features of the common reliable connection oriented protocols, while broadcast will not because the unreliable network protocols does not implement flow control and has only poor error control in the form of e.g. \ac{FEC}.

The probability of the sinks' success in receiving packets from the server is the same for both broadcast and unicast, see Equation \eqref{eq:broadcastandunicastpmf}, the only difference is the minimum number of transmissions. Provided that all unicast nodes will need the same amount of transmissions.

\begin{align}
\label{eq:broadcastandunicastpmf}
p_{\mathrm{succes}} &= \left( 1 - (1 - p)^{\frac{t}{m}} \right)^{n \g x}
\intertext{Where:}
p_{\mathrm{succes}}&\text{ is probability that all nodes receiving at least one of each unique packet}\notag\\
x&\text{ is the number of unique packets to each node}\notag\\
n&\text{ is the number of nodes} \notag\\
t&\text{ is the number of transmissions} \notag\\
m&\text{ is the minimum number of transmissions} \notag\\
p&\text{ is the probability that a node receives the transmitted packet} \notag
\end{align}

The \ac{pmf} is used to calculate the probability of success, $p_{\mathrm{bc}}$ and $p_{\mathrm{uc}}$, is as shown in Equation \eqref{eq:broadcastpmf} and \eqref{eq:unicastpmf}.

\begin{align}
\label{eq:broadcastpmf}
m_{\mathrm{bc}} &= x \hspace{3cm}\Rightarrow\\
p_{\mathrm{bc}} &= \left( 1 - (1 - p)^{\frac{t}{x}} \right)^{n \g x}&\notag\\
\intertext{Where:}
p_{\mathrm{bc}}&\text{ is probability that all nodes receiving at least one of each unique packet}\notag\\
m_{\mathrm{bc}}&\text{ is the minimum number of transmissions for broadcast}\notag\\
\end{align}

\begin{align}
\label{eq:unicastpmf}
m_{\mathrm{uc}} &= x \g n \hspace{3cm}\Rightarrow\\
p_{\mathrm{uc}} &= \left( 1 - (1 - p)^{\frac{t}{x \g n}} \right)^{n \g x}\notag\\
\intertext{Where:}
p_{\mathrm{uc}}&\text{ is probability that all nodes receiving at least one of each unique packet}\notag\\
m_{\mathrm{uc}}&\text{ is the minimum number of transmissions for broadcast}\notag\\
\end{align}

The total amount of transmitted packets are calculated as shown in Equation \eqref{eq:broadcasttotalpackets} and \eqref{eq:unicasttotalpackets}, the ratio between $x_{\mathrm{uc}}$ and $x_{\mathrm{bc}}$ shows that unicast requires $n$-times as many packets as broadcast, see Equation \eqref{eq:unicastbroadcastratio}.

\begin{align}
x_{\mathrm{uc}} &= t \g x \g n \label{eq:unicasttotalpackets}\\
x_{\mathrm{bc}} &= t \g x \label{eq:broadcasttotalpackets}
\intertext{Where:}
x_{\mathrm{bc}}&\text{ is the total amount of send packets using broadcast}\notag\\
x_{\mathrm{uc}}&\text{ is the total amount of send packets using unicast}\notag
\end{align}

\begin{align}
\frac{x_{\mathrm{uc}}}{x_{\mathrm{bc}}} &= \frac{t \g x \g n}{t \g x} &\Rightarrow\label{eq:unicastbroadcastratio}\\
\frac{x_{\mathrm{uc}}}{x_{\mathrm{bc}}} &= n &\Rightarrow\notag\\
x_{\mathrm{uc}} &= n \g x_{\mathrm{bc}}\notag
\end{align}

As showed in Equation \eqref{eq:unicastbroadcastratio} the bandwidth, the amount of packets required, is not the same for unicast and broadcast. To illustrate this a fixed scenario is chosen: 10 nodes, 100 unique packets and 10 \% packet loss, see Figure \ref{fig:comparisonofunicastandbroadcast}. 

\begin{figure}[!ht]
\centering
\includegraphics[width=1\textwidth]{figs/netcod_plot2.eps}
\caption{Comparison of broadcast and unicast both with retransmissions, unicast is seen to require the number of nodes times more transmissions as compared to broadcast which in this case is 10.}
\label{fig:comparisonofunicastandbroadcast}
\end{figure}

The figure mentioned, and Equation \eqref{eq:unicastbroadcastratio}, shows that the required bandwidth is significantly higher for unicast. If the number of sinks goes to one, then the stability of unicast are predominant compared to the parallellity of broadcast. Thus making unicast the better choice. However if the number of sinks is higher than one, then the proportions become the opposite. Thus making broadcast the better choice.
